sorting materials into group